.class Lorg/springframework/util/AntPathMatcher$AntPatternComparator;
.super Ljava/lang/Object;
.source "AntPathMatcher.java"

# interfaces
.implements Ljava/util/Comparator;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lorg/springframework/util/AntPathMatcher;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "AntPatternComparator"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Ljava/util/Comparator",
        "<",
        "Ljava/lang/String;",
        ">;"
    }
.end annotation


# instance fields
.field private final path:Ljava/lang/String;


# direct methods
.method private constructor <init>(Ljava/lang/String;)V
    .locals 0
    .parameter "path"

    .prologue
    .line 377
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 378
    iput-object p1, p0, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->path:Ljava/lang/String;

    .line 379
    return-void
.end method

.method synthetic constructor <init>(Ljava/lang/String;Lorg/springframework/util/AntPathMatcher$AntPatternComparator;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 377
    invoke-direct {p0, p1}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;-><init>(Ljava/lang/String;)V

    return-void
.end method

.method private getPatternLength(Ljava/lang/String;)I
    .locals 2
    .parameter "pattern"

    .prologue
    .line 450
    invoke-static {}, Lorg/springframework/util/AntPathMatcher;->access$0()Ljava/util/regex/Pattern;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;

    move-result-object v0

    .line 451
    .local v0, m:Ljava/util/regex/Matcher;
    const-string v1, "#"

    invoke-virtual {v0, v1}, Ljava/util/regex/Matcher;->replaceAll(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->length()I

    move-result v1

    return v1
.end method

.method private getWildCardCount(Ljava/lang/String;)I
    .locals 2
    .parameter "pattern"

    .prologue
    .line 440
    const-string v0, ".*"

    invoke-virtual {p1, v0}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_0

    .line 441
    const/4 v0, 0x0

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v1

    add-int/lit8 v1, v1, -0x2

    invoke-virtual {p1, v0, v1}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object p1

    .line 443
    :cond_0
    const-string v0, "*"

    invoke-static {p1, v0}, Lorg/springframework/util/StringUtils;->countOccurrencesOf(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    return v0
.end method


# virtual methods
.method public bridge synthetic compare(Ljava/lang/Object;Ljava/lang/Object;)I
    .locals 1
    .parameter
    .parameter

    .prologue
    .line 1
    check-cast p1, Ljava/lang/String;

    check-cast p2, Ljava/lang/String;

    invoke-virtual {p0, p1, p2}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->compare(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    return v0
.end method

.method public compare(Ljava/lang/String;Ljava/lang/String;)I
    .locals 11
    .parameter "pattern1"
    .parameter "pattern2"

    .prologue
    .line 382
    if-nez p1, :cond_0

    if-nez p2, :cond_0

    .line 383
    const/4 v10, 0x0

    .line 436
    :goto_0
    return v10

    .line 385
    :cond_0
    if-nez p1, :cond_1

    .line 386
    const/4 v10, 0x1

    goto :goto_0

    .line 388
    :cond_1
    if-nez p2, :cond_2

    .line 389
    const/4 v10, -0x1

    goto :goto_0

    .line 391
    :cond_2
    iget-object v10, p0, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->path:Ljava/lang/String;

    invoke-virtual {p1, v10}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    .line 392
    .local v2, pattern1EqualsPath:Z
    iget-object v10, p0, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->path:Ljava/lang/String;

    invoke-virtual {p2, v10}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    .line 393
    .local v4, pattern2EqualsPath:Z
    if-eqz v2, :cond_3

    if-eqz v4, :cond_3

    .line 394
    const/4 v10, 0x0

    goto :goto_0

    .line 396
    :cond_3
    if-eqz v2, :cond_4

    .line 397
    const/4 v10, -0x1

    goto :goto_0

    .line 399
    :cond_4
    if-eqz v4, :cond_5

    .line 400
    const/4 v10, 0x1

    goto :goto_0

    .line 402
    :cond_5
    invoke-direct {p0, p1}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->getWildCardCount(Ljava/lang/String;)I

    move-result v8

    .line 403
    .local v8, wildCardCount1:I
    invoke-direct {p0, p2}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->getWildCardCount(Ljava/lang/String;)I

    move-result v9

    .line 405
    .local v9, wildCardCount2:I
    const-string v10, "{"

    invoke-static {p1, v10}, Lorg/springframework/util/StringUtils;->countOccurrencesOf(Ljava/lang/String;Ljava/lang/String;)I

    move-result v0

    .line 406
    .local v0, bracketCount1:I
    const-string v10, "{"

    invoke-static {p2, v10}, Lorg/springframework/util/StringUtils;->countOccurrencesOf(Ljava/lang/String;Ljava/lang/String;)I

    move-result v1

    .line 408
    .local v1, bracketCount2:I
    add-int v6, v8, v0

    .line 409
    .local v6, totalCount1:I
    add-int v7, v9, v1

    .line 411
    .local v7, totalCount2:I
    if-eq v6, v7, :cond_6

    .line 412
    sub-int v10, v6, v7

    goto :goto_0

    .line 415
    :cond_6
    invoke-direct {p0, p1}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->getPatternLength(Ljava/lang/String;)I

    move-result v3

    .line 416
    .local v3, pattern1Length:I
    invoke-direct {p0, p2}, Lorg/springframework/util/AntPathMatcher$AntPatternComparator;->getPatternLength(Ljava/lang/String;)I

    move-result v5

    .line 418
    .local v5, pattern2Length:I
    if-eq v3, v5, :cond_7

    .line 419
    sub-int v10, v5, v3

    goto :goto_0

    .line 422
    :cond_7
    if-ge v8, v9, :cond_8

    .line 423
    const/4 v10, -0x1

    goto :goto_0

    .line 425
    :cond_8
    if-ge v9, v8, :cond_9

    .line 426
    const/4 v10, 0x1

    goto :goto_0

    .line 429
    :cond_9
    if-ge v0, v1, :cond_a

    .line 430
    const/4 v10, -0x1

    goto :goto_0

    .line 432
    :cond_a
    if-ge v1, v0, :cond_b

    .line 433
    const/4 v10, 0x1

    goto :goto_0

    .line 436
    :cond_b
    const/4 v10, 0x0

    goto :goto_0
.end method
